cmake_minimum_required(VERSION 3.16)

project(baidunet VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 COMPONENTS Quick WebView REQUIRED)

qt_add_executable(appbaidunet
    main.cpp
    BaiduLogin.cpp
    BaiduToken.cpp
    BaiduPan.cpp
    localdir.cpp
)

qt_add_qml_module(appbaidunet
    URI baidunet
    VERSION 1.0
    QML_FILES
        main.qml
        BaiduLoginUI.qml
        FileManagerUI.qml
        QuotaUI.qml
        CmpUI.qml
        TransferUI.qml
    RESOURCES
        "resource/box.png"
        "resource/file.png"
        "resource/fontello.ttf"
)

set_target_properties(appbaidunet PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_compile_definitions(appbaidunet
    PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(appbaidunet
    PRIVATE Qt6::Quick
    PRIVATE Qt6::WebView
)
